package cn.cloud.jianghai.userservice.feignClient;

import cn.cloud.jianghai.jianghaicommon.entity.R;
import cn.cloud.jianghai.userapi.dto.UserDto.UserDto;
import cn.cloud.jianghai.userapi.feign.UserApi;
import cn.cloud.jianghai.userservice.query.UserQuery;
import cn.cloud.jianghai.userservice.service.UserService;
import cn.hutool.core.collection.CollectionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Jiang.h
 * created 2022/5/30 17:54
 */
@RestController
public class UserFeignClient implements UserApi {


    @Autowired
    private UserService userService;

    @Override
    public R<List<UserDto>> findUserList(List<Long> idList) {

        if (CollectionUtil.isEmpty(idList)) {
            return R.success(new ArrayList<>());
        }

        UserQuery query = new UserQuery();

        return R.success(userService.findUserList(query));
    }
}
